import Vue from 'vue'
import VueRouter from 'vue-router'
import LoginUser from "@/views/LoginUser.vue";
import Zhuye from "@/views/Zhuye.vue";
import Ordermanagement from "@/views/Ordermanagement.vue";
import UserManagment from "@/views/UserManagment.vue";
import Register from "@/views/Register.vue";

Vue.use(VueRouter)

const routes = [
  {
    path: '/', // 默认路径指向登录页
    name: 'LoginUser',
    component: LoginUser
  },
  {
    path: '/Zhuye', // 首页路径
    name: 'Zhuye',
    component: Zhuye,
    children: [
      {
        path: 'user', // 用户管理子路径
        component: UserManagment
      },
      {
        path: 'order', // 商品管理子路径
        component: Ordermanagement
      }
    ]
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
